<?php

class MY_Model extends Model
{

	function getMessages($controller,$action){
		$this->db->select('page_message.variable_name,messages.value');
		$this->db->from('page_message');
		$this->db->join('pages', 'page_message.page_id = pages.id');
		$this->db->join('messages', 'page_message.message_id = messages.id');
		$this->db->where('pages.controller', $controller);
		$this->db->where('pages.action', $action);
		$query = $this->db->get();
		$msgs =  $query->result_array();
		foreach($msgs as $msg)
		{
			$messages[$msg['variable_name']] = $msg['value'];
		}
		return $messages;
	}
	
	
}

?>